package 第八章;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@WebServlet("/demo2")
public class Servlet02 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<User> users = new ArrayList<User>();
        users.add(new User(1,"梅西","男",35,"阿根廷",1));
        users.add(new User(2,"C罗","男",37,"葡萄牙",0));
        users.add(new User(3,"内马尔","男",30,"巴西",1));
        request.setAttribute("users",users);
        request.setAttribute("status",1);
        request.getRequestDispatcher("/jstl.jsp").forward(request,response);
    }
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}